import { eLayoutType, RoutesService } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';

export const APP_ROUTE_PROVIDER = [
  { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true }
];

function configureRoutes(routes: RoutesService) {
  return () => {
    routes.add([
      {
        path: '/',
        name: '::Menu:Home',
        iconClass: 'fas fa-home',
        order: 1,
        layout: eLayoutType.application
      },
      {
        name: '::Menu:Info',
        iconClass: 'fas fa-sitemap'
      },
      // {
      //   parentName: '::Menu:Info',
      //   path: '/books',
      //   name: '::Menu:Books',
      //   iconClass: 'fas fa-book',
      //   layout: eLayoutType.application,
      //   requiredPolicy: 'SignChannel.Books'
      // },
      {
        parentName: '::Menu:Info',
        path: '/people',
        name: '::Menu:People',
        iconClass: 'fas fa-user-friends',
        layout: eLayoutType.application
        // requiredPolicy: 'SignChannel.Books',
      },
      {
        parentName: '::Menu:Info',
        path: '/times',
        name: '::Menu:Time',
        iconClass: 'fas fa-clock',
        layout: eLayoutType.application
        // requiredPolicy: 'SignChannel.Books',
      },
      {
        path: '/card-sign',
        name: '::Menu:CardSign',
        iconClass: 'fas fa-card',
        layout: eLayoutType.empty
        // requiredPolicy: 'SignChannel.Books',
      }
    ]);
  };
}
